package com.dkm.ec.product.persistence.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.util.string.StringUtils;
import com.dkm.base.db.mybatis.dao.MyBatisQueryDaoImpl;
import com.dkm.ec.product.persistence.dao.ProdRecQueryDao;
import com.dkm.ec.product.persistence.entity.ProdRecPo;

/**
 * 对象功能:关联产品推荐 QueryDao接口的实现
 * 开发公司:SKG.COM
 * 开发人员:Yuki
 * 创建时间:2015-02-28 18:15:41
 */
@Repository
public class ProdRecQueryDaoImpl extends MyBatisQueryDaoImpl<String, ProdRecPo> implements ProdRecQueryDao{

    @Override
    public String getNamespace() {
        return ProdRecPo.class.getName();
    }

	@Override
	public List<ProdRecPo> getProdRecListByBaseIdAndTypeKey(String baseId,String typeKey) {
		return findByKey("getProdRecListByBaseIdAndTypeKey", b().a("baseId", baseId).a("typeKey", typeKey).p());
	}
	@Override
	public List<ProdRecPo> getProdRecListByBaseIdsAndTypeKey(String baseIds,String typeKey) {
		if(StringUtils.isEmpty(baseIds)){
			return new  ArrayList<ProdRecPo>();
		}
		baseIds=" ('"+baseIds.replaceAll(",", "','")+"')";
		return findByKey("getProdRecListByBaseIdAndTypeKey", b().a("baseIds", baseIds).a("typeKey", typeKey).p());
	}
	
}
